#pragma once

#include "../IPhoneDisk/singleton.hpp"

class CFileInfo
{
public:
	string st_name;
	string st_path;
	string st_blocks;
	string st_ifmt;
	string st_mtime;
	string st_nlink;
	string st_size;
};

class CAMDeviceFileSystemImpl :
	public AMobileDevice
{
public:
	CAMDeviceFileSystemImpl(void);
	virtual ~CAMDeviceFileSystemImpl(void);
	virtual void OnConnected(am_device* lpDevice);
	virtual void OnDisconnected(am_device* lpDevice);

	vector<CFileInfo> GetDirectories(string strPath);
	vector<CFileInfo> GetAll(string strPath);
	void ConvertDictionary(afc_dictionary* lpDict, map<string, string>& dict);
	CFileInfo GetFileInfo(string strPath);

private:
	HANDLE m_hInitEvent;
	am_device* m_lpAMDevice;
	afc_connection* m_lpAFCHandle;
	afc_connection* m_lpAFConnection;
};

typedef Singleton<CAMDeviceFileSystemImpl> CAMDeviceFileSystem;
